﻿/**
 * 大厅视图控制
 * 
 * @author LuoDong
 * @email luo4521@online.net.tw
 * 2010-2-5 14:19
 */
package com.addcn.texas.view
{
	import flash.display.*;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.display.Stage;		
	
	import com.addcn.fog.view.*;
	import com.addcn.fog.control.*;
	import com.addcn.fog.model.*;
	
	import com.addcn.texas.Main;
	import com.addcn.texas.control.*
	import com.addcn.texas.view.*;
	import com.addcn.texas.model.*;
	
	import com.addcn.common.utils.AppLibary;
	import com.addcn.common.utils.RemoveAllChildren;
		
	public class FriendsView extends View
	{				
		public static const GET_ROOMS :String = "getRooms"
		protected var _container : Sprite;
		private var _app : AppLibary = AppLibary.getInstance();	
		private var _class : Class;
		
		public function FriendsView(r_target : Object) {	
			_container = new Sprite();
			r_target.addChild(_container);				
		}			
		
		/**
		 * 該視圖中介器需要偵聽的通知
		 */
		override public function notificationsList():void 
		{
			notifications = [
							Main.APP_STARTUP,	
							];
		}
		
		override public function onDataChanged(r_notification:String, r_data:Object = null):void {
			switch (r_notification) {
				case Main.APP_STARTUP:  //执行初始化				
					_intialize();	
					break;							
			}			
		}
		
		private function _intialize() : void
		{		
			//var _sprite = new Sprite();
			//_container.addChild(_sprite);	
			//_container = _sprite;
			//添加好友框到显示列表
			_class = this._app.getClass("com.addcn.texas.view.components.FriendBox");		
			trace(">>"+_class)
			if (_class) {
				var _fd =  new _class;
				_fd.x = 549;
				_fd.y = 203;
				_fd.name = "friendsBox";
			    _container.addChild(_fd);
			}			
			
		}		
		
		override public function destroy():void 
		{			
			RemoveAllChildren.remove(_container as DisplayObject);		
			_container.parent.removeChild(_container);
		}
		
	}
	
}
